package leetcode.p283;

/***
 * 移动零
 * [0,1,3,0,12]   --->  [1,3,12,0,0]
 */
public class Solution {
    public void moveZeroes(int[] nums) {
        int insertpos = 0;
        for(int num : nums) {
            if(num != 0) {
                nums[insertpos++] = num;
            }
        }
        while(insertpos < nums.length){
            nums[insertpos++] = 0;
        }
    }
}
